package com.wc.trainTest.X的最终值;

import java.util.*;

/**
 * @Author congge
 * @Date 2024/1/24 23:40
 * @description https://acm.creative3605.com/contest/60/problem/E
 */


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long xor = 0;
        long add = 0;
        long or = 0;
        int n = sc.nextInt();
        long x = sc.nextInt();
        while (n-- > 0) {
            int t = sc.nextInt();
            int a = sc.nextInt();
            if (t == 1) {
                add |= a;
                or &= a;
                xor &= a;
            } else if (t == 2) {
                or |= a;
            } else if (t == 3) {
                xor ^= a;
            }
            x ^= xor;
            x |= or;
            if (t == 1) {
                x &= add;
            }
            System.out.println(x);
        }
    }
}
